/*
*	create by  jack ,20210705
*
*	描述 ：
*		  该文件提供了一套设备调用的接口，屏蔽具体实现细节,以达到应用程序可以在不同的平台上联合调试。
*		  open 返回该设备枚举类别。无设备实现时，返回负数.
*   修改记录：[内容][作者][时间]
*
*/


#ifndef _SANJI_OS_NVIC_H_
#define _SANJI_OS_NVIC_H_

#include "define_comm.h"

#include "stm32f1xx_hal.h"
#include "stm32f1xx.h"

typedef void (*nvic_irq_callback)(void *arg);
#define MAX_IRQ_CALLBACK_NUM 3

struct nvic_irq_group
{
    nvic_irq_callback callback;
    sj_char callback_init;
    sj_void *arg;
};

struct nvic_irq_hander
{
    sj_char init;
    struct nvic_irq_group irq_group[MAX_IRQ_CALLBACK_NUM];
    sj_void *ptr;
    union
    {
        TIM_HandleTypeDef tim_hander;
        UART_HandleTypeDef usart_hander;
        EXTI_HandleTypeDef exti_hander;
        RTC_HandleTypeDef rtc_hander; //slj add
        ADC_HandleTypeDef adc_handler;
    };
};

struct nvic_irq_hander *nvic_get_tim_handler(sj_char id);

struct nvic_irq_hander *nvic_get_usart_handler(sj_char id);

struct nvic_irq_hander *nvic_get_exti_handler(sj_char id);

struct nvic_irq_hander *nvic_get_rtc_handler(sj_char id);

struct nvic_irq_hander *nvic_get_adc_handler(sj_char id);

void nvic_set_tim_callback(sj_char id,sj_int8 index,nvic_irq_callback callback,sj_void *arg);






#endif
